package com.qf.spbtrabbitmq.controller;

import com.qf.spbtrabbitmq.config.RabbitConfig;
import com.qf.spbtrabbitmq.pojo.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class FanoutSender {
    @Autowired
    private AmqpTemplate amqpTemplate;


    public void send(User user) {
        //第一个参数：Exchange名字
        //第二个参数：Route-Key
        //第三个参数：要发送的内容
        amqpTemplate.convertAndSend(RabbitConfig.FANOUT_EXCHANGE,"",user);
    }

}
